package magicbook.gtlitecore.loaders.multiblock;

import gregtech.api.metatileentity.multiblock.CleanroomType;

import static gregtech.api.GTValues.*;
import static gregtech.api.recipes.RecipeMaps.CANNER_RECIPES;
import static gregtech.api.unification.material.Materials.*;
import static gregtech.api.unification.ore.OrePrefix.*;
import static magicbook.gtlitecore.api.recipe.GTLiteRecipeMaps.VACUUM_CHAMBER_RECIPES;
import static magicbook.gtlitecore.api.recipe.GTLiteRecipeMaps.VIRTUAL_COSMOS_SIMULATOR_RECIPES;
import static magicbook.gtlitecore.api.unification.GTLiteMaterials.*;
import static magicbook.gtlitecore.common.items.GTLiteMetaItems.*;

public class VirtualCosmosSimulator {

    public static void init() {
        MemoryCards();
        Recipes();
    }

    private static void MemoryCards() {
        //  Cosmic Memory Card
        VACUUM_CHAMBER_RECIPES.recipeBuilder()
                .input(MEMORY_CARD_BASE)
                .input(plate, Neutronium)
                .input(spring, Hypogen)
                .input(wireFine, TransitionHAlloy, 4)
                .fluidInputs(CosmicComputingMixture.getFluid(L))
                .output(COSMIC_MEMORY_CARD)
                .EUt(VA[UXV])
                .duration(200)
                .cleanroom(CleanroomType.CLEANROOM)
                .buildAndRegister();

        //  Overworld
        CANNER_RECIPES.recipeBuilder()
                .input(COSMIC_MEMORY_CARD)
                .fluidInputs(Air.getFluid(1000))
                .output(COSMIC_MEMORY_CARD_OVERWORLD)
                .EUt(VA[LV])
                .duration(20)
                .buildAndRegister();

        //  Nether
        CANNER_RECIPES.recipeBuilder()
                .input(COSMIC_MEMORY_CARD)
                .fluidInputs(NetherAir.getFluid(1000))
                .output(COSMIC_MEMORY_CARD_NETHER)
                .EUt(VA[LV])
                .duration(20)
                .buildAndRegister();

        //  End
        CANNER_RECIPES.recipeBuilder()
                .input(COSMIC_MEMORY_CARD)
                .fluidInputs(EnderAir.getFluid(1000))
                .output(COSMIC_MEMORY_CARD_END)
                .EUt(VA[LV])
                .duration(20)
                .buildAndRegister();
    }

    private static void Recipes() {
        //  TODO Rebalance
        //  This machine should has three modes: Drone Mining Mode, Cosmic Memory Card Mode, Universal Devourer Mode...
        //  This machine has 81 slot inputs and 18 slot outputs, so we can do many things!
        //  Should this machine has Generator Mode?

        //  WARNING TODO This recipes is just in testing, so maybe too imba...

        //  Overworld
        VIRTUAL_COSMOS_SIMULATOR_RECIPES.recipeBuilder()
                .notConsumable(COSMIC_MEMORY_CARD_OVERWORLD)
                .output(dust, Stone, 240891153)
                .output(dust, Iron, 14904458)
                .output(dust, Redstone, 8577758)
                .output(dust, Coal, 7946767)
                .output(dust, Tin, 6069951)
                .output(dust, Copper, 4601556)
                .output(dust, Apatite, 4394273)
                .output(dust, Charcoal, 3951050)
                .output(dust, Gold, 2754785)
                .output(dust, Lazurite, 2334718)
                .output(dust, Sodalite, 2299106)
                .output(dust, Zinc, 2247413)
                .output(dust, Lapis, 2217594)
                .output(dust, Nickel, 1698365)
                .output(dust, Silver, 1553258)
                .output(dust, Salt, 1005473)
                .output(dust, RockSalt, 1005473)
                .output(dust, Cobalt, 950388)
                .output(dust, Oilsands, 818526)
                .output(dust, Graphite, 769969)
                .output(dust, Rheniite, 727578)
                .output(dust, GarnetSand, 727578)
                .output(dust, Zeolite, 545684)
                .output(dust, GarnetRed, 545684)
                .output(dust, TricalciumPhosphate, 445136)
                .output(dust, Thorium, 404153)
                .output(dust, Wollastonite, 363789)
                .output(dust, Soapstone, 363789)
                .output(dust, VanadiumMagnetite, 363789)
                .output(dust, Talc, 363789)
                .output(dust, GarnetYellow, 363789)
                .output(dust, Lead, 327910)
                .output(dust, Gallium, 207101)
                .output(dust, Sulfur, 204415)
                .output(dust, Diamond, 200799)
                .output(dust, Ruby, 199578)
                .output(dust, RareEarth, 190296)
                .output(dust, Pyrochlore, 184168)
                .output(dust, Grossular, 181894)
                .output(dust, Spessartine, 181894)
                .output(dust, Mica, 181894)
                .output(dust, Kyanite, 181894)
                .output(dust, Glowstone, 178088)
                .output(dust, FullersEarth, 159157)
                .output(dust, Basalt, 153600)
                .output(dust, Carbon, 153600)
                .output(dust, GraniteBlack, 153600)
                .output(dust, Cadmium, 145515)
                .output(dust, Alumina, 141600)
                .output(dust, GraniteRed, 128842)
                .output(dust, Phosphate, 128842)
                .output(dust, Asbestos, 110147)
                .output(dust, Borax, 101052)
                .output(dust, Magnesium, 97768)
                .output(dust, Alunite, 90947)
                .output(dust, Diatomite, 90947)
                .output(dust, Gypsum, 90947)
                .output(dust, Platinum, 69033)
                .output(dust, GlauconiteSand, 68210)
                .output(dust, Emerald, 68210)
                .output(dust, Calcite, 66694)
                .output(dust, Spodumene, 56842)
                .output(dust, Lepidolite, 56842)
                .output(dust, Andradite, 55073)
                .output(dust, Trona, 45473)
                .output(dust, Sphalerite, 45473)
                .output(dust, Vanadium, 40421)
                .output(dust, Manganese, 29810)
                .output(dust, SiliconDioxide, 27789)
                .output(dust, Tantalite, 25263)
                .output(dust, Sodium, 24000)
                .output(dust, Pyrolusite, 22736)
                .output(dust, Pollucite, 22736)
                .output(dust, Calcium, 20210)
                .output(dust, Lithium, 18315)
                .output(dust, Chrome, 14400)
                .output(dust, Niobium, 11115)
                .output(dust, Caesium, 11115)
                .output(dust, Sapphire, 10105)
                .output(dust, Tantalum, 2273)
                .output(dust, Rubidium, 2273)
                .fluidOutputs(Hydrogen.getFluid(11152000))
                .fluidOutputs(Oxygen.getFluid(11152000))
                .fluidOutputs(Fluorine.getFluid(11152000))
                .fluidOutputs(Chlorine.getFluid(11152000))
                .fluidOutputs(Argon.getFluid(11152000))
                .fluidOutputs(Krypton.getFluid(11152000))
                .fluidOutputs(Tin.getPlasma(2576000))
                .fluidOutputs(Iron.getPlasma(2576000))
                .fluidOutputs(Americium.getPlasma(2576000))
                .fluidOutputs(Nickel.getPlasma(2576000))
                .fluidOutputs(StarCoreMatter.getPlasma(2576000))
                .fluidOutputs(WhiteDwarfMatter.getFluid(1256000))
                .fluidOutputs(BlackDwarfMatter.getFluid(1256000))
                .fluidOutputs(DimensionallyTranscendentResidue.getFluid(576000))
                .fluidOutputs(MagnetoHydrodynamicallyConstrainedStarMatter.getFluid(576000))
                .fluidOutputs(TemporalFluid.getFluid(102400))
                .fluidOutputs(Galaxium.getFluid(5760))
                .fluidOutputs(Spacetime.getFluid(2880))
                .EUt((int) V[OpV])
                .duration(1200)
                .buildAndRegister();

        //  Nether
        VIRTUAL_COSMOS_SIMULATOR_RECIPES.recipeBuilder()
                .notConsumable(COSMIC_MEMORY_CARD_NETHER)
                .output(dust, Netherrack, 1372372)
                .output(dust, Redstone, 14869369)
                .output(dust, NetherQuartz, 13001421)
                .output(dust, Iron, 9995596)
                .output(dust, Sulfur, 7689024)
                .output(dust, Copper, 7544503)
                .output(dust, Saltpeter, 5140831)
                .output(dust, Zinc, 2006728)
                .output(dust, CertusQuartz, 1910286)
                .output(dust, Tin, 1892833)
                .output(dust, Gold, 1420023)
                .output(dust, Realgar, 1399898)
                .output(dust, Selenium, 1372372)
                .output(dust, Beryllium, 1323439)
                .output(dust, Nickel, 1247756)
                .output(dust, Quartzite, 1053039)
                .output(dust, Silver, 1022703)
                .output(dust, Lead, 893729)
                .output(dust, Antimony, 874129)
                .output(dust, Diatomite, 870803)
                .output(dust, Barite, 845772)
                .output(dust, Cobalt, 836460)
                .output(dust, Electrotine, 544251)
                .output(dust, Grossular, 435401)
                .output(dust, Spessartine, 435401)
                .output(dust, Emerald, 357392)
                .output(dust, Bismuth, 349974)
                .output(dust, RareEarth, 329153)
                .output(dust, Glowstone, 312565)
                .output(dust, Cadmium, 204396)
                .output(dust, Ruby, 163275)
                .output(dust, GarnetYellow, 149366)
                .output(dust, Molybdenum, 145436)
                .output(dust, Gallium, 143870)
                .output(dust, GarnetRed, 110059)
                .output(dust, Alunite, 108850)
                .output(dust, Wulfenite, 108850)
                .output(dust, Sapphire, 96755)
                .output(dust, Thorium, 81637)
                .output(dust, Manganese, 71357)
                .output(dust, Tantalite, 60472)
                .output(dust, Pyrolusite, 54425)
                .output(dust, TricalciumPhosphate, 54425)
                .output(dust, Calcium, 48377)
                .output(dust, Chrome, 34469)
                .output(dust, Calcite, 32655)
                .output(dust, Uranium238, 17234)
                .output(dust, Powellite, 13606)
                .output(dust, Electrum, 12094)
                .output(dust, Niobium, 11489)
                .output(dust, Diamond, 10885)
                .output(dust, Alumina, 9070)
                .output(dust, Tantalum, 5442)
                .fluidOutputs(Lava.getFluid(11152000))
                .fluidOutputs(BlazingPyrotheum.getFluid(11152000))
                .fluidOutputs(Bromine.getFluid(11152000))
                .fluidOutputs(Redstone.getFluid(11152000))
                .fluidOutputs(Xenon.getFluid(11152000))
                .fluidOutputs(Radon.getFluid(11152000))
                .fluidOutputs(Argon.getPlasma(2576000))
                .fluidOutputs(Nitrogen.getPlasma(2576000))
                .fluidOutputs(Oxygen.getPlasma(2576000))
                .fluidOutputs(Taranium.getPlasma(2576000))
                .fluidOutputs(StarCoreMatter.getPlasma(2576000))
                .fluidOutputs(WhiteDwarfMatter.getFluid(1256000))
                .fluidOutputs(BlackDwarfMatter.getFluid(1256000))
                .fluidOutputs(DimensionallyTranscendentResidue.getFluid(576000))
                .fluidOutputs(MagnetoHydrodynamicallyConstrainedStarMatter.getFluid(576000))
                .fluidOutputs(TemporalFluid.getFluid(102400))
                .fluidOutputs(Galaxium.getFluid(5760))
                .fluidOutputs(Spacetime.getFluid(2880))
                .EUt((int) V[OpV])
                .duration(1200)
                .buildAndRegister();

        //  End
        VIRTUAL_COSMOS_SIMULATOR_RECIPES.recipeBuilder()
                .notConsumable(COSMIC_MEMORY_CARD_END)
                .output(dust, Endstone, 213278385)
                .output(dust, Iron, 13141511)
                .output(dust, Tin, 7715733)
                .output(dust, Copper, 5827057)
                .output(dust, Lazurite, 5748480)
                .output(dust, Sodalite, 5736960)
                .output(dust, Zinc, 4157511)
                .output(dust, Nickel, 3790097)
                .output(dust, Gold, 3642240)
                .output(dust, Silver, 2995555)
                .output(dust, Lead, 2598044)
                .output(dust, Naquadah, 1487040)
                .output(dust, Beryllium, 1400640)
                .output(dust, Bentonite, 1382400)
                .output(dust, Magnesite, 1382400)
                .output(dust, Antimony, 925120)
                .output(dust, Scheelite, 921600)
                .output(dust, Lapis, 896000)
                .output(dust, Cobalt, 857777)
                .output(dust, Sulfur, 573440)
                .output(dust, Grossular, 460800)
                .output(dust, Spessartine, 460800)
                .output(dust, VanadiumMagnetite, 460800)
                .output(dust, Magnesium, 449280)
                .output(dust, NaquadahEnriched, 396480)
                .output(dust, Uranium235, 378240)
                .output(dust, Platinum, 348817)
                .output(dust, Gallium, 341333)
                .output(dust, Alumina, 320640)
                .output(dust, Calcium, 250880)
                .output(dust, Molybdenum, 205120)
                .output(dust, Cadmium, 184320)
                .output(dust, Manganese, 178880)
                .output(dust, Olivine, 172800)
                .output(dust, GlauconiteSand, 172800)
                .output(dust, Palladium, 139520)
                .output(dust, Wulfenite, 115200)
                .output(dust, Calcite, 115200)
                .output(dust, GarnetRed, 97280)
                .output(dust, Plutonium239, 97280)
                .output(dust, Thorium, 86400)
                .output(dust, Tantalite, 64000)
                .output(dust, Tungstate, 57600)
                .output(dust, Pyrolusite, 57600)
                .output(dust, Vanadium, 51200)
                .output(dust, Lithium, 37760)
                .output(dust, Sodium, 36480)
                .output(dust, Pyrope, 36480)
                .output(dust, Iridium, 27520)
                .output(dust, TricalciumPhosphate, 25600)
                .output(dust, Osmium, 24320)
                .output(dust, Naquadria, 24320)
                .output(dust, Powellite, 14400)
                .output(dust, Niobium, 12160)
                .output(dust, Orichalcum, 9600)
                .output(dust, Tellurium, 5760)
                .output(dust, Mithril, 1600)
                .fluidOutputs(DragonBreath.getFluid(11152000))
                .fluidOutputs(GelidCryotheum.getFluid(11152000))
                .fluidOutputs(Tennessine.getFluid(11152000))
                .fluidOutputs(DragonBlood.getFluid(11152000))
                .fluidOutputs(MetastableOganesson.getFluid(11152000))
                .fluidOutputs(MetastableHassium.getFluid(11152000))
                .fluidOutputs(HighEnergyQuarkGluonPlasma.getPlasma(2576000))
                .fluidOutputs(QuasifissioningPlasma.getPlasma(2576000))
                .fluidOutputs(CelestialTungsten.getPlasma(2576000))
                .fluidOutputs(AstralTitanium.getPlasma(2576000))
                .fluidOutputs(StarCoreMatter.getPlasma(2576000))
                .fluidOutputs(WhiteDwarfMatter.getFluid(1256000))
                .fluidOutputs(BlackDwarfMatter.getFluid(1256000))
                .fluidOutputs(DimensionallyTranscendentResidue.getFluid(576000))
                .fluidOutputs(MagnetoHydrodynamicallyConstrainedStarMatter.getFluid(576000))
                .fluidOutputs(TemporalFluid.getFluid(102400))
                .fluidOutputs(Galaxium.getFluid(5760))
                .fluidOutputs(Spacetime.getFluid(2880))
                .EUt((int) V[OpV])
                .duration(1200)
                .buildAndRegister();

        //  TODO Deep Dark?
    }
}
